<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>列表</title>
</head>
<style>
    *{
        margin:0;
        padding:0;
        list-style:none;
        text-decoration:none;
    }
.list li{
    margin-top:0.1rem;
}
    .list li:nth-child(1){
        margin-top:0;
    }
</style>
<script>
    window.onload = function(){
        /*720代表设计师给的设计稿的宽度，你的设计稿是多少，就写多少;100代表换算比例，这里写100是
          为了以后好算,比如，你测量的一个宽度是100px,就可以写为1rem,以及1px=0.01rem等等*/
        getRem(375,100)
    };
    window.onresize = function(){
        getRem(375,100)
    };

    function getRem(pwidth,prem){
        var html = document.getElementsByTagName("html")[0];
        var oWidth = document.body.clientWidth || document.documentElement.clientWidth;
        html.style.fontSize = oWidth/pwidth*prem + "px";
    }

</script>

<body>

<header style="width:100%;height:0.66rem;background:#48A1FF;border-top:1px solid #48a1ff;position:relative;">
    <img src="img/logo1.png" alt="" style="display:block;width:1.30rem;height:0.16rem;margin-left:1.22rem;margin-top:0.26rem;float:left;">
    <span style="display:block;float:right;width:0.58rem;height:0.2rem;margin-right:0.16rem;margin-top:0.26rem;font-size:0.14rem;color:#fff;font-family: PingFangSC-Medium;" class="signout">Sign out</span>
</header>


<content>
    <ul class="list" style="width:100%;height:auto;">

    </ul>
</content>


<div class="">
    <img class="more" src="img/addicon.png" alt="" style="width:0.7rem;height:0.7rem;position:fixed;left:50%;margin-left:-0.35rem;">
</div>










</body>
<script src="jquery-1.8.3.min.js"></script>
<script src="js/commonscript.js"></script>
<script>
$(function(){

    $.ajax({
        url:url+'/address/selectPage',
        type:'post',
        data:{
           createUser:localStorage.tel,
           token:localStorage.token
        },
        success:function(result){
            var data=result.data;
            $.each(data,function(i,v){
                var li=`
                <li style="width:100%;height:1.07rem;background:#F4F8F9;
    'border-radius:0.04rem;" data-id="${v.addressId}">
                       <div style="width:10%;height:100%;float:left;">
                               <img src="img/location.png" alt="" style="width:0.12rem;height:0.164rem;display:block;margin-top:0.16rem;margin-left:0.16rem;">
                           </div>
                       <div style="width:70%;height:100%;float:left;">

                           <span style="width:100%;height:0.7rem;display:block;font-family: PingFangSC-Medium;
font-size:0.2rem;
color:#48A1FF;margin-top:0.12rem;" class="detailtaddress">
                               ${v.country+' '+v.state+' '+v.city+' '+v.address+' '+v.doorNum+' '+v.zipCode}
                           </span>
                           <span style="width:100%;height:0.21rem;display:block;margin-bottom:0.04rem;">
                                 <span style="display:block;float:left;font-family: PingFangSC-Light;
font-size:0.16rem;
color: #969B9E;">${v.buildingType}</span>
                                 <span style="display:block;float:left;font-family: PingFangSC-Light;
font-size:0.16rem;
color:#969B9E;margin-left:0.1rem;">${v.company}</span>
                           </span>


                       </div>
                       <div style="width:20%;height:100%;float:left;">
                               <img src="img/edit.png" alt="" style="width:0.3rem;height:0.3rem;display:block;margin-top:0.4rem;margin-left:0.2rem;" class="edit">
                            </div>
                   </li>
                      `

                $('.list').append(li);
            });
        }
    });




//                var li=`
//                <li style="width:100%;height:1.07rem;background:#F4F8F9;
//    'border-radius:0.04rem;" data-id="11">
//                       <div style="width:10%;height:100%;float:left;">
//                               <img src="img/location.png" alt="" style="width:0.12rem;height:0.164rem;display:block;margin-top:0.16rem;margin-left:0.16rem;">
//                           </div>
//                       <div style="width:70%;height:100%;float:left;">
//
//                           <span style="width:100%;height:0.7rem;display:block;font-family: PingFangSC-Medium;
//font-size:0.2rem;
//color:#48A1FF;margin-top:0.12rem;" class="detailtaddress">
//                              中国浙江省杭州市余杭区塞银国际广场12号楼602
//                           </span>
//
//                           <span style="width:100%;height:0.21rem;display:block;margin-bottom:0.04rem;">
//                                 <span style="display:block;float:left;font-family: PingFangSC-Light;
//font-size:0.16rem;
//color: #969B9E;">集团</span>
//                                 <span style="display:block;float:left;font-family: PingFangSC-Light;
//font-size:0.16rem;
//color:#969B9E;margin-left:0.1rem;">容大智造</span>
//                           </span>
//
//
//                       </div>
//                       <div style="width:20%;height:100%;float:left;">
//                               <img src="img/edit.png" alt="" style="width:0.3rem;height:0.3rem;display:block;margin-top:0.4rem;margin-left:0.2rem;" class="edit">
//                            </div>
//                   </li>
//`;
//
//                $('.list').append(li);


//   点击页面跳转事件
    $(document).on('click','.edit',function(){

            window.location.href='edit.html?id='+$(this).parents().parents('li').attr('data-id');
      });


    setTimeout(function(){
        var height=$('.list').height();
        console.log(height);
        if(height<260){
            $('.more').css('top','50%');
        }
        else{
            $('.more').css('top','90%');
        }
    },1000);

    $('.more').on('click',function(){
        window.location.href="address.html";
    });

    $('.signout').on('click',function(){
        window.location.href='login.html';
        localStorage.tel='';
    })


});






</script>
</html>